package com.yanqu.road.logic.activity.hotpotjump.game.choose;

import com.yanqu.road.logic.activity.hotpotjump.game.JumpBoardGrid;
import com.yanqu.road.logic.activity.hotpotjump.game.eJumpDirection;
import com.yanqu.road.utils.RandomHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * 5 盘面随机点
 */
public class HotpotJumpSkillChoose5 extends HotpotJumpSkillChoose {
    @Override
    public List<List<JumpBoardGrid>> chooseGrid() {
        List<List<JumpBoardGrid>> result = new ArrayList<>();

        List<JumpBoardGrid> allGrids = new ArrayList<>();
        for (JumpBoardGrid[] grids : gameLogic.board.board) {
            for (JumpBoardGrid grid : grids) {
                if (grid == null) {
                    continue;
                }
                if (gameLogic.board.getOutLineGrids().contains(grid)) {//数值说排除轮廓点
                    continue;
                }
                allGrids.add(grid);
            }
        }

        int randomNum = skillRange.getRangeNum();
        List<JumpBoardGrid> chooseGrids = gameLogic.randomHelper.getRandomList(allGrids, randomNum);

        for (JumpBoardGrid grid : chooseGrids) {
            List<JumpBoardGrid> grids = gameLogic.calcRangeGrids(grid, skillRange, eJumpDirection.None);
            result.add(grids);
        }

        return result;
    }
}
